﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntityObjects;
using DAL_V1.App_Code.DBBroker;

namespace BAL.Controller
{
    public class DelHeadAuthorityController

    {
        private static List<Employee> empe_list;
        private static List<Department> dep_list;
        //singleton
        private static bool instance_flag = false;
        private static DelHeadAuthorityController instance;


        public static DelHeadAuthorityController getDelHeadAuthorityController()
        {
            if (!instance_flag)
            {
                instance = new DelHeadAuthorityController();
                instance_flag = true;

                return instance;
            }
            else
            {
                return instance;
            }
        }

       
        public Employee selectEmployee(String Id)
        {

            Employee empAll = EmployeeDBBroker.getEmployeeDBBroker().selectEmployee(Id);
            return empAll;
        }

        /*Select Employee list by Dept Id
        public List<Employee>selectEmployeeByDept(String id)
        {
            empe_list = new List<Employee>();
            empe_list = EmployeeDBBroker.getEmployeeDBBroker().selectEmployeeByDept(id);
            return empe_list;
        }*/

        /*Retrieve DeptEmpList except DeptHead*/
        public List<Employee> getEmployeeByListByManager(String deptId, String empId)
        {
            empe_list = new List<Employee>();
            empe_list = EmployeeDBBroker.getEmployeeDBBroker().getEmployeeByListByManager(deptId, empId);
            return empe_list;
           
        }
        public List<Employee> getEmployeebyDeptIdAndEmpName(String deptId, String empName)
        {
            empe_list = new List<Employee>();
            empe_list = EmployeeDBBroker.getEmployeeDBBroker().getEmployeebyDeptIdAndEmpName(deptId, empName);
            return empe_list;
        }

        public int updateEmployee(Employee emp, String Id)
        {

            int result = 0;
            result = EmployeeDBBroker.getEmployeeDBBroker().updateEmployee(emp, Id);
            return result;
        }


        public List<CollectionPoint> selectAllCollectionPoint()
        {
            List<CollectionPoint> cp_list = new List<CollectionPoint>();
            cp_list = CollectionPointDBBroker.getCollectionPointDBBroker().selectAllCollectionPoint();
           
            return cp_list;
        }

        public List<Department> selectAllDepartment()
        {
            dep_list = new List<Department>();
            dep_list = DepartmentDBBroker.getDepartmentDBBroker().selectAllDepartment();
            return dep_list;

        }
        public Employee getEmployeebyDeptIdAndRole(String deptId, int roleId)
        {
            Employee emp = new Employee();
            emp = EmployeeDBBroker.getEmployeeDBBroker().getEmployeebyDeptIdAndRole(deptId, roleId);
            return emp;

        }


    }
}
